package edu.gym4all.service.domain;

import android.os.Parcel;
import android.os.Parcelable;
import edu.gym4all.service.ExerciseEnum;
import edu.gym4all.service.HypertrophyExercise;

public class Hypertrophy implements HypertrophyExercise, Parcelable {

	private ExerciseEnum exercise;

	private int series;

	private int reps;

	public Hypertrophy(ExerciseEnum exercise, int series, int reps) {
		this.exercise = exercise;
		this.series = series;
		this.reps = reps;
	}

	public Hypertrophy(Parcel source) {
		this.readFromParcel(source);
	}

	@Override
	public ExerciseEnum getExercise() {
		return this.exercise;
	}

	@Override
	public int getSeries() {
		return this.series;
	}

	@Override
	public int getReps() {
		return this.reps;
	}

	@Override
	public void setSeries(int series) {
		this.series = series;
	}

	@Override
	public void setReps(int reps) {
		this.reps = reps;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeParcelable(this.exercise, flags);
		dest.writeInt(this.series);
		dest.writeInt(this.reps);
	}

	public static final Parcelable.Creator<Hypertrophy> CREATOR = new Parcelable.Creator<Hypertrophy>() {

		@Override
		public Hypertrophy createFromParcel(Parcel source) {
			return new Hypertrophy(source);
		}

		@Override
		public Hypertrophy[] newArray(int size) {
			return new Hypertrophy[size];
		}
	};

	private void readFromParcel(Parcel in) {
		this.exercise = in.readParcelable(ExerciseEnum.class.getClassLoader());
		this.series = in.readInt();
		this.reps = in.readInt();
	}

	@Override
	public String toString() {
		return this.exercise.getExerciseName();
	}
}